#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ep emplace
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

int read() {
	int x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;
using tl = tuple < int, int, int >;

const int N = 2e5 + 10;
const int V = 1 << 21;

vec G[N];
int fa[N], siz[N], cnt[V], son[N], rt, a[N], n;
ll ans[N];
bool vis[N];

void getsz(int x, int p) { siz[x] = 1; son[x] = 0; for(auto y : G[x]) if(y ^ p && !vis[y]) getsz(y, x), siz[x] += siz[y], son[x] = max(son[x], siz[y]); }

void getrt(int x, int p, int tsz) { for(auto y : G[x]) if(y ^ p && !vis[y]) getrt(y, x, tsz); son[x] = max(son[x], tsz - siz[x]); if(rt == 0 || son[x] < son[rt]) rt = x; }

void get(int x, int p, int stu, int del) {
	stu ^= 1 << a[x]; cnt[stu] += del;
	for(auto y : G[x]) if(y ^ p && !vis[y]) get(y, x, stu, del);
}

ll calc(int x, int p, int stu) {
	stu ^= 1 << a[x];
	ll tot = cnt[stu]; rep(i, 0, 19) tot += cnt[stu ^ 1 << i];
	for(auto y : G[x]) if(y ^ p && !vis[y]) tot += calc(y, x, stu);
	ans[x] += tot;
	return tot;
}

void divide(int x) {
	getsz(x, 0); rt = 0; getrt(x, 0, siz[x]); x = rt; vis[x] = true; get(x, 0, 0, 1);
	ll tot = 0; tot += cnt[0]; rep(i, 0, 19) tot += cnt[1 << i];
	for(auto y : G[x]) if(!vis[y]) {
			get(y, x, 1 << a[x], -1); tot += calc(y, x, 0); get(y, x, 1 << a[x], 1);
		}
	ans[x] += tot / 2; get(x, 0, 0, -1);
	for(auto y : G[x]) if(!vis[y]) divide(y);
}

char s[N];

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in;	rep(i, 2, n) { int u = in, v = in; G[u].pb(v); G[v].pb(u); }
	scanf("%s", s + 1); rep(i, 1, n) a[i] = s[i] - 'a';
	divide(1); rep(i, 1, n) printf("%lld%c", ans[i] + 1, " \n"[i == n]); 
	return 0;
}
